package com.example.order.remote;

import com.example.common.req.payment.PaymentReq;
import com.example.common.resp.GlobalResult;
import com.example.common.resp.payment.PaymentResp;
import com.example.order.remote.fallback.PaymentFallbackService;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;

@FeignClient(value = "cloud-payment-service", fallback = PaymentFallbackService.class)
public interface PaymentService {

    @PostMapping("/payment/create")
    GlobalResult<Long> create(PaymentReq payment);

    @GetMapping("/payment/get/{id}")
    GlobalResult<PaymentResp> get(@PathVariable("id") Long id);

    @GetMapping(value = "/hystrix/success")
    GlobalResult<String> success();

    @GetMapping(value = "/hystrix/timeout")
    GlobalResult<String> timeout();
}
